#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Niklas Hauser
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------

def init(module):
    module.name = ":communication:amnb"
    module.description = FileReader("module.md")

def prepare(module, options):
    module.depends(
        ":math:utils",
        ":processing:resumable",
        ":processing:timer",
        ":container",
        ":utils")

    module.add_option(
        BooleanOption(name="with_heap",
                      description="Allow large messages to allocate on the heap.",
                      default=True))

    return True

def build(env):
    env.substitutions = {
        "target": env[":target"].identifier,
        "with_heap": env["with_heap"]
    }
    env.outbasepath = "modm/src/modm/communication/amnb"
    env.template("message.hpp.in")
    env.copy("interface.hpp")
    env.copy("handler.hpp")
    env.copy("node.hpp")
    env.copy("../amnb.hpp")
